<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<nav class="navbar navbar-default navbar-static-top">
	<div class="container">
		<div class="navbar-header">
	   		<!-- <a class="navbar-brand" href="#"></a> -->
	 	</div>
	  	<div class="navbar-collapse collapse">
			<ul class="nav navbar-nav" id="navbar">
			   <li><a href="${ctx}/sys/main">德燊</a></li>
			   <li><a href="${ctx}/banner/findBanner">Banner管理</a></li>
			   <li><a href="${ctx}/core/findCore">业务管理</a></li>
			   <li><a href="${ctx}/typical/findTypical">案例管理</a></li>
				<li><a href="${ctx}/recruit/findRecruit">招聘管理</a></li>
			   <li><a href="${ctx}/info/findInfo">信息管理</a></li>
			</ul>
			<ul class="nav navbar-nav navbar-right">
				<li class="dropdown">
					<a href="#" id="abc" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">个人中心<span class="caret"></span></a>
	         	 	<ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu">
						<li class="disabled"><a tabindex="-1" href="#">账号：${userInfo.userName}</a></li>
						<li class="disabled"><a tabindex="-1" href="#">角色：${userInfo.roleName}</a></li>
						<li class="divider"></li>
						<li><a href="#" id="updPassword_btn" data-toggle="modal" data-target="#updPasswordModal">修改密码</a></li>
					</ul>
				</li>
				<li><a href="${ctx}/sys/loginout" title="安全退出">安全退出&nbsp;</a></li>
			</ul>
		</div>
	</div>
</nav>
<!-- 模态框（Modal） -->
<div class="modal fade" id="updPasswordModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
   <div class="modal-dialog">
      <div class="modal-content">
         <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
            <h5 class="modal-title" id="myModalLabel">修改密码</h5>
         </div>
         <div class="modal-body">
         	<div class="form-horizontal">
	         	<div class="form-group">
					 <label class="col-sm-4 control-label">新密码</label>
				     <div class="col-sm-6">
				     	<input type="password" id="password" maxlength="16" class="form-control"/>
				     </div>
				</div>
				<div class="form-group">
					 <label class="col-sm-4 control-label">确认密码</label>
				     <div class="col-sm-6">
				     	<input type="password" id="confirm_password" maxlength="16" class="form-control">
				     </div>
				</div>
				<div class="modal-footer">
					<input class="btn btn-info" id="updPassword_btn" onclick="updPassword();" type="button" value="确定" aria-hidden="true" />
					<input class="btn btn-warning" type="button" value="取消" data-dismiss="modal" />
				</div>
			</div>
         </div>
      </div><!-- /.modal-content -->
	</div><!-- /.modal -->
</div>

<script type="text/javascript">
	function updPassword(){
		var password = $("#password").val();
		if(password == ""){
			alert("请输入新密码");
			return ;
		}
		if(password.length < 6){
			alert("新密码必须大于6位");
			return ;
		}
		var confirmPassword = $("#confirm_password").val();
		if(password != confirmPassword){
			alert("两次密码不一致");
			return ;
		}
		ajaxRequestTB("${ctx}/sys/updPassword",
			{password:password},
			function(data) {
				if (data.retCode == 1) {
					$('#updPasswordModal').modal('hide');
				}
				alert(data.retMsg);
			});
	}
</script>

